package ch7;

import java.util.Scanner;

public class Zxf2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入距形的高和宽：");
        int a = 0;
        int b = 0;
       // int i = 0;
        for (; !(a >= 3 && b >= 3); ) {
            a = in.nextInt();
            b = in.nextInt();
           // if (a < 3 || b < 3) {
                System.out.println("输入错误，重新输入：");
                continue;
            }
            for (int i = 1; i <= a; i++) {
                for (int j = 1; j <= b; j++) {
                    if (i == 1 || i == a || j == 1 || j == b) {
                        System.out.print("*");
                    } else {
                        System.out.print(" ");
                    }
                }
                System.out.println("");
            }
        }
    }
//}

